package main

import (
	"fmt"
	"github.com/dwbmio/ding-cli/cmd"
	"github.com/wonderivan/logger"
	"os"
)

func initLogger() {
	logger.SetLogger(`
{
    "TimeFormat":"2006-01-02 15:04:05", 
    "Console": {            
        "level": "TRAC",   
        "color": true     
    },
    "File": {                   
        "filename": "app.log",  
        "level": "TRAC",        
        "daily": true,          
        "maxlines": 1000000,    
        "maxsize": 1,           
        "maxdays": -1,          
        "append": true,         
        "permit": "0660"        
    }
}
`)
}

func main() {
	//initLogger()
	rootCli := cmd.RootCli()
	rootCli.AddCommand(cmd.Init()) 		   //init
	rootCli.AddCommand(cmd.GenNginxConf()) //gen nginx conf
	rootCli.AddCommand(cmd.Run())          //run
	rootCli.AddCommand(cmd.Stop())         //stop
	rootCli.AddCommand(cmd.Reload())       //reload

	if err := rootCli.Execute(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}
